import Vue from 'vue';
import Vuex from 'vuex';
import counter from './counter';
import equipment from './equipment';

Vue.use(Vuex);

const store = new Vuex.Store({
    modules: {
        counter,
        equipment,
    },
    state: {
        // 状态
        userDetails: {},
        moveShow: [],
    },
    getters: {
        // 获取器
    },
    mutations: {
        // 变更
        setUserDetails(state, res) {
            state.userDetails = res;
        },
        setMoveShow(state, res) {
            state.moveShow = res;
        },
    },
    actions: {
        // 动作
        depositUserDetails({commit}, res) {
            commit('setUserDetails', res);
            console.log(res, 'res');
        },
        //设备
        moveShow({commit}, res) {
            commit('setMoveShow', res);
        },
    },
});

export default store;
